---
title: Habitat - Demo - Adding Services to an Existing Group
description: The “Try Habitat” is an interactive, in-browser demo that walks you through how to build, configure, and run packages in Habitat.
step: 7
total_steps: 7
---
h2.page-body--title Adding Services to an Existing Group

p
  | Now that we've got our first node running, we went ahead and added a second running
    node for you since this topology requires a minimum of three. Once we add a third,
    we'll see them elect a leader for the group.

p
  | Adding a new node to a group is as simple as setting a flag that references any existing
    peer (by IP address or hostname) in the target Service Group.

p
  | Start the third node, then switch between all three windows to see that each
    node has been connected to one another.

code
  | hab start -t leader core/redis --peer 172.17.0.4

.window-buttons
  ul
    li
      a.button.secondary data-target="window-node-1" Node 1 - <span class="node-status">waiting for quorum</span> <span class="button-badge">&nbsp;</span>
    li
      a.button.secondary data-target="window-node-2" Node 2 - <span class="node-status">waiting for quorum</span> <span class="button-badge">&nbsp;</span>
    li
      a.button.secondary.active data-target="window-node-3" Node 3 - <span class="node-status">not started</span>

.shell-panel.window-node id="window-node-1" style="display:none;"
  pre
    | # node 1 is up and running
      hab-sup(MN): Starting core/redis
      hab-sup(GS): Supervisor 172.17.0.4: 2e4cc8a8-d89e-4739-b14f-8ff526b99da5
      hab-sup(GS): Census redis.default: 32d54eaf-35e4-4052-8fc9-d16773251778
      hab-sup(GS): Starting inbound gossip listener
      hab-sup(GS): Starting outbound gossip distributor
      hab-sup(GS): Starting gossip failure detector
      hab-sup(CN): Starting census health adjuster
      hab-sup(SC): Updated redis.config
      hab-sup(TP): Restarting because the service config was updated via the census
      hab-sup(TL): 1 of 3 census entries; waiting for minimum quorum
  pre.full-output
    | hab-sup(TL): Minimum quorum met!
      hab-sup(TL): I have quorum, but no leader; starting an election!
      hab-sup(TL): Starting election
      hab-sup(TP): Writing our census rumor: CensusEntry {
          id: Uuid("2bb69c17-c56e-4319-ab9e-6165e290cb68"),
          member_id: Uuid("8912c6ec-2b6a-4b76-a676-5b3ed86589bb"),
          hostname: "3e8b621280ef",
          ip: "172.17.0.4",
          suitability: 0,
          port: Some(
              "6379"
          ),
          exposes: Some(
              [
                  "6379"
              ]
          ),
          leader: true,
          follower: false,
          data_init: false,
          vote: None,
          election: None,
          needs_write: Some(
              true
          ),
          initialized: false,
          keep_me: true,
          service: "redis",
          group: "default",
          alive: true,
          suspect: false,
          confirmed: false,
          detached: false,
          incarnation: LamportClock {
              counter: 1
          }
      }
      redis(SV): Starting
      hab-sup(TP): Writing our census rumor: CensusEntry {
          id: Uuid("2bb69c17-c56e-4319-ab9e-6165e290cb68"),
          member_id: Uuid("8912c6ec-2b6a-4b76-a676-5b3ed86589bb"),
          hostname: "3e8b621280ef",
          ip: "172.17.0.4",
          suitability: 0,
          port: Some(
              "6379"
          ),
          exposes: Some(
              [
                  "6379"
              ]
          ),
          leader: true,
          follower: false,
          data_init: false,
          vote: None,
          election: None,
          needs_write: Some(
              true
          ),
          initialized: true,
          keep_me: true,
          service: "redis",
          group: "default",
          alive: true,
          suspect: false,
          confirmed: false,
          detached: false,
          incarnation: LamportClock {
              counter: 2
          }
      }
      redis(O):                 _._
      redis(O):            _.-``__ ''-._
      redis(O):       _.-``    `.  `_.  ''-._           Redis 3.0.7 (00000000/0) 64 bit
      redis(O):   .-`` .-```.  ```\/    _.,_ ''-._
      redis(O):  (    '      ,       .-`  | `,    )     Running in standalone mode
      redis(O):  |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
      redis(O):  |    `-._   `._    /     _.-'    |     PID: 91
      redis(O):   `-._    `-._  `-./  _.-'    _.-'
      redis(O):  |`-._`-._    `-.__.-'    _.-'_.-'|
      redis(O):  |    `-._`-._        _.-'_.-'    |           http://redis.io
      redis(O):   `-._    `-._`-.__.-'_.-'    _.-'
      redis(O):  |`-._`-._    `-.__.-'    _.-'_.-'|
      redis(O):  |    `-._`-._        _.-'_.-'    |
      redis(O):   `-._    `-._`-.__.-'_.-'    _.-'
      redis(O):       `-._    `-.__.-'    _.-'
      redis(O):           `-._        _.-'
      redis(O):               `-.__.-'
      redis(O):
      redis(O): 91:M 03 May 15:32:29.622 # Server started, Redis version 3.0.7
      redis(O): 91:M 03 May 15:32:29.623 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
      redis(O): 91:M 03 May 15:32:29.623 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
      redis(O): 91:M 03 May 15:32:29.623 * The server is now ready to accept connections on port 6379
      redis(O): 91:M 03 May 15:32:30.671 * Slave 172.17.0.6:6379 asks for synchronization
      redis(O): 91:M 03 May 15:32:30.671 * Full resync requested by slave 172.17.0.6:6379
      redis(O): 91:M 03 May 15:32:30.671 * Starting BGSAVE for SYNC with target: disk
      redis(O): 91:M 03 May 15:32:30.675 * Background saving started by pid 96
      redis(O): 96:C 03 May 15:32:30.682 * DB saved on disk
      redis(O): 96:C 03 May 15:32:30.682 * RDB: 4 MB of memory used by copy-on-write
      redis(O): 91:M 03 May 15:32:30.716 * Background saving terminated with success
      redis(O): 91:M 03 May 15:32:30.718 * Synchronization with slave 172.17.0.6:6379 succeeded
      redis(O): 91:M 03 May 15:32:30.902 * Slave 172.17.0.5:6379 asks for synchronization
      redis(O): 91:M 03 May 15:32:30.902 * Full resync requested by slave 172.17.0.5:6379
      redis(O): 91:M 03 May 15:32:30.902 * Starting BGSAVE for SYNC with target: disk
      redis(O): 91:M 03 May 15:32:30.904 * Background saving started by pid 97
      redis(O): 97:C 03 May 15:32:30.911 * DB saved on disk
      redis(O): 97:C 03 May 15:32:30.911 * RDB: 4 MB of memory used by copy-on-write
      redis(O): 91:M 03 May 15:32:30.916 * Background saving terminated with success
      redis(O): 91:M 03 May 15:32:30.918 * Synchronization with slave 172.17.0.5:6379 succeeded

.shell-panel.window-node id="window-node-2" style="display:none;"
  pre
    | # node 2 is up and running
      hab-sup(MN): Starting core/redis
      hab-sup(GS): Supervisor 172.17.0.5: 2e4cc8a8-d89e-4739-b14f-8ff526b99da5
      hab-sup(GS): Census redis.default: 32d54eaf-35e4-4052-8fc9-d16773251778
      hab-sup(GS): Starting inbound gossip listener
      hab-sup(GS): Starting outbound gossip distributor
      hab-sup(GS): Starting gossip failure detector
      hab-sup(CN): Starting census health adjuster
      hab-sup(SC): Updated redis.config
      hab-sup(TP): Restarting because the service config was updated via the census
      hab-sup(TL): 2 of 3 census entries; waiting for minimum quorum
  pre.full-output
    | hab-sup(TL): Minimum quorum met!
      hab-sup(TL): I have quorum, but no leader; starting an election!
      hab-sup(TL): Starting election
      hab-sup(TL): Becoming a follower
      hab-sup(TP): Writing our census rumor: CensusEntry {
          id: Uuid("5e834e6f-74ef-411b-9ba8-50089e1cea54"),
          member_id: Uuid("30af2038-0d9f-436c-a9fc-418380cc745a"),
          hostname: "58bc81a3e127",
          ip: "172.17.0.5",
          suitability: 0,
          port: Some(
              "6379"
          ),
          exposes: Some(
              [
                  "6379"
              ]
          ),
          leader: false,
          follower: true,
          data_init: false,
          vote: None,
          election: None,
          needs_write: Some(
              true
          ),
          initialized: false,
          keep_me: true,
          service: "redis",
          group: "default",
          alive: true,
          suspect: false,
          confirmed: false,
          detached: false,
          incarnation: LamportClock {
              counter: 1
          }
      }
      hab-sup(SC): Updated redis.config
      hab-sup(TP): Restarting because the service config was updated via the census
      redis(SV): Starting
      hab-sup(TP): Writing our census rumor: CensusEntry {
          id: Uuid("5e834e6f-74ef-411b-9ba8-50089e1cea54"),
          member_id: Uuid("30af2038-0d9f-436c-a9fc-418380cc745a"),
          hostname: "58bc81a3e127",
          ip: "172.17.0.5",
          suitability: 0,
          port: Some(
              "6379"
          ),
          exposes: Some(
              [
                  "6379"
              ]
          ),
          leader: false,
          follower: true,
          data_init: false,
          vote: None,
          election: None,
          needs_write: Some(
              true
          ),
          initialized: true,
          keep_me: true,
          service: "redis",
          group: "default",
          alive: true,
          suspect: false,
          confirmed: false,
          detached: false,
          incarnation: LamportClock {
              counter: 2
          }
      }
      redis(O):                 _._
      redis(O):            _.-``__ ''-._
      redis(O):       _.-``    `.  `_.  ''-._           Redis 3.0.7 (00000000/0) 64 bit
      redis(O):   .-`` .-```.  ```\/    _.,_ ''-._
      redis(O):  (    '      ,       .-`  | `,    )     Running in standalone mode
      redis(O):  |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
      redis(O):  |    `-._   `._    /     _.-'    |     PID: 94
      redis(O):   `-._    `-._  `-./  _.-'    _.-'
      redis(O):  |`-._`-._    `-.__.-'    _.-'_.-'|
      redis(O):  |    `-._`-._        _.-'_.-'    |           http://redis.io
      redis(O):   `-._    `-._`-.__.-'_.-'    _.-'
      redis(O):  |`-._`-._    `-.__.-'    _.-'_.-'|
      redis(O):  |    `-._`-._        _.-'_.-'    |
      redis(O):   `-._    `-._`-.__.-'_.-'    _.-'
      redis(O):       `-._    `-.__.-'    _.-'
      redis(O):           `-._        _.-'
      redis(O):               `-.__.-'
      redis(O):
      redis(O): 94:S 03 May 15:32:29.903 # Server started, Redis version 3.0.7
      redis(O): 94:S 03 May 15:32:29.903 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
      redis(O): 94:S 03 May 15:32:29.903 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
      redis(O): 94:S 03 May 15:32:29.904 * The server is now ready to accept connections on port 6379
      redis(O): 94:S 03 May 15:32:30.900 * Connecting to MASTER 172.17.0.4:6379
      redis(O): 94:S 03 May 15:32:30.900 * MASTER <-> SLAVE sync started
      redis(O): 94:S 03 May 15:32:30.900 * Non blocking connect for SYNC fired the event.
      redis(O): 94:S 03 May 15:32:30.901 * Master replied to PING, replication can continue...
      redis(O): 94:S 03 May 15:32:30.902 * Partial resynchronization not possible (no cached master)
      redis(O): 94:S 03 May 15:32:30.904 * Full resync from master: 8f26ced9f2d32e8208cef177d6315ec0152838c9:1
      redis(O): 94:S 03 May 15:32:30.916 * MASTER <-> SLAVE sync: receiving 18 bytes from master
      redis(O): 94:S 03 May 15:32:30.917 * MASTER <-> SLAVE sync: Flushing old data
      redis(O): 94:S 03 May 15:32:30.917 * MASTER <-> SLAVE sync: Loading DB in memory
      redis(O): 94:S 03 May 15:32:30.917 * MASTER <-> SLAVE sync: Finished with success

#window-node-3.window-node
  = partial "partials/terminal" do

#success
  = partial "partials/advance_button" do
    | Finish - Next Steps

= partial "partials/previous_button" do
  | Back to previous step
